# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-crochet
pkgname=('python2-crochet' 'python-crochet')
_pkgname=crochet
pkgver=2.1.1
pkgrel=3
pkgdesc='Use Twisted anywhere! - An MIT-licensed library that makes it easier to use Twisted from regular blocking code.'
url='https://pypi.org/project/crochet/'
license=('MIT')
arch=('any')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('8effcfdad43a00500721c2d7c989440efc7abe4d771ec52a3484e1c80c198e56646b24c9e51ca71222923a8cbef56014fd7cb99f4e68db7cf979e92730880bb2')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-crochet() {
  depends=('python2' 'python2-twistedx' 'python2-wrapt')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-crochet() {
  depends=('python' 'python-twisted' 'python-wrapt')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

